 angular.module("dashboardApp")
 .controller('lsListCtrl', function($scope, $routeParams, $http, BASE_URL) {
 	$scope.lessonList = [];
 	$scope.placeList = [];
 	$scope.personList = [];

 	$scope.listType = $routeParams.type;
 	// $scopw.$watch('listType')

	switch($scope.listType) {
		case 'lesson':
			$http.post(BASE_URL + 'application_api/lesson/getlessonlist')
			.then(function(prm) {
				angular.forEach(prm.data, function(ls) {
					$scope.lessonList.push(ls);
				});

				setTimeout(function() {
					$scope.$apply(function() {
						$scope.$parent.loadingView = false;
					})
				},500);
			})
			break;

		case 'place':
			$http.post(BASE_URL + 'dashboard_api/reference/getplaces')
			.then(function(prm) {
				angular.forEach(prm.data, function(ls) {
					$scope.placeList.push(ls);
				});

				setTimeout(function() {
					$scope.$apply(function() {
						$scope.$parent.loadingView = false;
					})
				},500);
			})
			break;

		case 'person':
			$http.post(BASE_URL + 'dashboard_api/reference/getpersons')
			.then(function(prm) {
				angular.forEach(prm.data, function(ls) {
					$scope.personList.push(ls);
				});

				setTimeout(function() {
					$scope.$apply(function() {
						$scope.$parent.loadingView = false;
					})
				},500);
			})
			break;
	}
		
 })